<template>
  <!-- 公共的流程表单drawer按钮 -->
  <div>
    <a-button v-if="!disableSubmit" :disabled="buttonDisable || isDisabledAuth('startProcess')" @click="beginProcess" type="primary" style="margin-bottom: 0; margin-right: 20px;">提交流程</a-button>
    <a-button v-if="!disableSubmit && isStaging" :disabled="buttonDisable" @click="handleOk" type="primary" style="margin-bottom: 0; margin-right: 20px;">暂存</a-button>
    <a-popconfirm title="确定关闭弹窗吗?" @confirm="handleCancel" :getPopupContainer="(node) => node.parentNode">
      <a-button style="margin-bottom: 0;">关闭</a-button>
    </a-popconfirm>
  </div>
</template>

<script>
import { DisabledAuthFilterMixin } from '@/mixins/DisabledAuthFilterMixin'
export default {
  name: 'CommonDrawerFooterButton',
  mixins: [DisabledAuthFilterMixin],
  props: {
    // 按钮是否显示
    disableSubmit: {
      type: Boolean,
      default: false
    },
    // 按钮是否可以点击
    buttonDisable: {
      type: Boolean,
      default: false
    },
    // 发起流程按钮控制
    startProcess: {
      type: String,
      default: ''
    },
    // 是否展示暂存按钮
    isStaging: {
      type: Boolean,
      default: true
    }

  },
  data () {
    return {

    }
  },
  methods: {
    // 点击关闭
    handleCancel () {
      this.$emit('handleCancel')
    },
    // 点击保存
    handleOk () {
      this.$emit('handleOk')
    },
    // 点击发起流程
    beginProcess () {
      this.$emit('beginProcess')
    }
  }
}
</script>

<style lang="less" scoped>

</style>
